package com.fengycx.fallback;

import com.fengycx.feign.CreateOrderApi;
import com.fengycx.param.CalculateResultParam;
import com.fengycx.param.SharedAmountDto;
import com.fengycx.param.SharedAmountResult;
import com.fengycx.result.CallDriverCalculatedBillResult;
import com.fengycx.result.R;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class CreateOrderApiFallbackFactory implements FallbackFactory<CreateOrderApi> {

    @Override
    public CreateOrderApi create(Throwable cause) {
        cause.printStackTrace();
        return new CreateOrderApi() {
            @Override
            public R<CallDriverCalculatedBillResult> getCallDriverCalculatedBillResult(CalculateResultParam param) {
                return R.error();
            }

            @Override
            public R<SharedAmountResult> sharedAmount(SharedAmountDto sharedAmountDto) {
                return R.error();
            }
        };

    }
}
